Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
Javascript .replace() method failing replacing ".–" with ".00"

I have a page displaying a price with .– instead of decimals .00:

<span id="product_price">123.&ndash;</span>

I am trying to switch its ending from ".–" to ".00" (or to nothing) in order to dynamically build the URL of a PayPal (unregistered) payment button, and cannot understand why Javascript's .replace() method fails replacing the .&ndash;.

Although the source code of the page shows the price is correctly written with the .&ndash; in the <span>, the console.log(amount); prints the amount with a - instead of the character entity:

var amount = jQuery("span#product_price").html();
console.log(amount);
amount = amount.toString(); // just to be sure
amount.replace('.&ndash;','.00');

Hence, I also tried amount.replace('.-','.00');

and var amount = jQuery("span#product_price").html().replace('.&ndash;','.00');

Nothing works. What I'm doing wrong? Thanks.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda